package com.sporadic.backstage.controller;

import com.sporadic.backstage.entity.DishesStatus;
import com.sporadic.backstage.service.DishesStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@CrossOrigin(origins = {"http://localhost:8080"}, methods = {RequestMethod.GET, RequestMethod.POST}, allowCredentials = "true")
@Controller
public class DishesStatusController {

    @Autowired
    private DishesStatusService dishesStatusService;

    /**
     * 查询菜品的所有状态
     * @return 返回菜品状态的信息
     */
    @RequestMapping("/findDishesStatus")
    @ResponseBody
    public List<DishesStatus> findDishesStatus(){
        return dishesStatusService.findDishesStatus();
    }


}
